package it.polimi.swim.entity;
import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

@NamedQueries({
	@NamedQuery(
			name="Feedback.getFeedbackByUser",
			query="SELECT f FROM HelpRequest h, Feedback f WHERE h.receiver = :id AND h.feedback=f.id")
})

@Entity
@Table(name="Feedback")
public class Feedback implements Serializable{
	
	private static final long serialVersionUID = -3813055525575946281L;

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private int id;
	
	@Column(name="evaluation")
	private Boolean evaluation;
	
	@Column(name="text")
	private String text;
	
	/*@ManyToOne
    @JoinColumn(name="idUser", nullable=false)
	private SystemUser user;
    public SystemUser getUser() { return user; }
*/
	@OneToOne( optional=false, mappedBy="feedback")
	HelpRequest help;
    
	public HelpRequest getHelp() { return help; }
	public void SetHelp(HelpRequest h){
		help = h;
	}
	//Get and Set
	public int getId() {
		return id;
	}
	
	public void setId(int id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Boolean getEvaluation() {
		return evaluation;
	}

	public void setEvaluation(Boolean evaluation) {
		this.evaluation = evaluation;
	}

}
